package org.rcy.framework.security.source;

import org.rcy.framework.security.login.LoginDetails;
import org.springframework.security.authentication.AuthenticationDetailsSource;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 吴康桥
 * @Description
 * @date 2022/10/28 17:13
 */


public class LoginAuthenticationDetailsSource implements AuthenticationDetailsSource<HttpServletRequest, LoginDetails> {
	@Override
	public LoginDetails buildDetails(HttpServletRequest request) {
		String remoteAddress = request.getRemoteAddr();
		String userAgent = request.getHeader("User-Agent");
		return new LoginDetails(remoteAddress, userAgent);
	}
}
